package chat1.client;

import javax.swing.*;
import java.awt.*;
import java.io.InputStream;
import java.io.OutputStream;

public class LoginWindow {
    JFrame win=null;
    JPanel contentPane=null;
    JLabel userNameLabel=null;//账号的标签
    JTextField userName=null;//1.文本框(输入账号)
    JLabel  pwdLabel=null;//密码的标签
    JPasswordField  pwd=null;//2.密码框
    JButton  loginBtn=null;//3.登录按钮
    JButton  regBtn=null;//4.注册按钮
    InputStream  in=null;
    OutputStream  out=null;
    LoginWindow(){
        win=new JFrame("登录窗口");//1.

        contentPane=new JPanel();//2.

        userNameLabel=new JLabel("账号：");//3.
        userNameLabel.setBounds(new Rectangle(18,53,335,38));
        userNameLabel.setFont(new Font("Dialog",Font.BOLD,14));
        contentPane.setLayout(null);
        contentPane.add(userNameLabel);

        userName=new JTextField();//4.
        userName.setBounds(new Rectangle(84,56,266,33));//宽高，处于界面的位置

        pwdLabel=new JLabel("密码：");//5.
        pwdLabel.setBounds(new Rectangle(18,107,335,38));

        pwd=new JPasswordField();//6.
        pwd.setBounds(new Rectangle(84,111,266,33));

        loginBtn=new JButton("登录");//7.
        loginBtn.setBounds( new Rectangle(143,162,120,41));

        regBtn=new JButton("注册");//8.
        regBtn.setBounds( new Rectangle(295,214,82,28));

        contentPane.add(userName);
        contentPane.add(pwdLabel);
        contentPane.add(pwd);
        contentPane.add(loginBtn);
        contentPane.add(regBtn);
        win.add(contentPane);
        win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        win.setSize(390,280);
        win.setVisible(true);

    }
}

